package com.dealin.dealinlibs.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.ImageView;

/**
 * Created by lenovo on 2016/11/8.
 */

public class ColorfulImageView extends ImageView {
    public int getColor() {
        return color;
    }

    public void setColor(int color) {
        this.color = color;
    }

    private int color= Color.BLUE;
    public ColorfulImageView(Context context) {
        super(context);
    }

    public ColorfulImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ColorfulImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        setColorFilter(color);
        super.onDraw(canvas);
    }
}
